<%@ page import="java.sql.ResultSet" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
    <script src="../public/layui/layui.js"></script>
    <style>
        .layui-form-label{
            margin-left:20%;
        }
    </style>
</head>
<body>
<jsp:useBean id="judge" scope="session" class="javabean.JDBCBean"></jsp:useBean>
<div align="center" style=" margin-top: 2%;"><h1>查询图书是否逾期</h1></div>
<div align="center"
     style="margin-left:30%; margin-top: 5%; width: 40%;">

    <form class="layui-form layui-form-pane" action="19judgesus.jsp">

        <div class="layui-form-item">
            <label class="layui-form-label">图书编号</label>
            <div class="layui-input-inline">
                <input type="text" name="bookid" lay-verify="required"
                       placeholder="请输入图书编号" autocomplete="off" class="layui-input"><br>
            </div>
        </div>


        <div class="layui-form-item" align="center">
            <button class="layui-btn layui-btn-warm" lay-submit="" lay-filter="demo2">查询</button>
        </div>
        <div style="font-size: 40px;margin: 20px">借阅目录</div>
        <%
            Object reader=session.getAttribute("reader");
            int readid=Integer.parseInt(reader.toString());
            String sql2="select*from borrow_books, books where books.id= borrow_books.book_id and card_id = "+readid+" and return_date is null";
            ResultSet rs2 = judge.executeQuery(sql2);
            String end = "";
            while (rs2.next()) {
        %>
        <div class="layui-form-item">

            <div class="layui-input-inline">
                <label class="layui-form-label" style="position: relative  ">bookid</label>
                <input type="text" name="end"  autocomplete="off"
                       class="layui-input" value=<%=rs2.getInt("book_id")%>><br>
            </div>
            <div class="layui-input-inline">
                <label class="layui-form-label" >bookname</label>
                <input type="text" name="end"  autocomplete="off"
                       class="layui-input" value=<%=rs2.getString("books.name")%>><br>
            </div>

        </div>

        <%}%>
    </form>


    <script>
        layui
            .use(
                [ 'form', 'layedit', 'laydate' ],
                function() {
                    var form = layui.form, layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate;
                    //日期
                    laydate.render({
                        elem : '#date1',
                        type : 'datetime',
                        format : 'yyyy-M-d H:m:s',
                        min:0,
                        max:0,
                        value: new Date()
                    });

                    //创建一个编辑器
                    var editIndex = layedit
                        .build('LAY_demo_editor');


                    //监听提交
                    form.on('submit(demo1)', function(data) {
                        layer.alert(JSON.stringify(data.field), {
                            title : '最终的提交信息'
                        })
                        return false;
                    });

                    //表单赋值
                    layui.$('#LAY-component-form-setval').on(
                        'click', function() {
                            form.val('example', {
                                "username" : "贤心" // "name": "value"
                                ,
                                "password" : "123456",
                                "interest" : 1,
                                "like[write]" : true //复选框选中状态
                                ,
                                "close" : true //开关状态
                                ,
                                "sex" : "女",
                                "desc" : "我爱 layui"
                            });
                        });

                    //表单取值
                    layui.$('#LAY-component-form-getval').on(
                        'click', function() {
                            var data = form.val('example');
                            alert(JSON.stringify(data));
                        });

                });
    </script>
</div>
</body>
</html>